/******************************************************************************
* File description: settingmodelconfigchangepwdui.cpp
* Function: 设置-模型配置：修改密码
* Current Version: 1.0.0
* Author: 张宇轩
* Date: 2024-08-31
*  -----
*  Copyright by 博坤生物 .
 *****************************************************************************/
#include "settingmodelconfigchangepwdui.h"

/**
 * @brief 构造函数
 */
SettingModelConfigChangePwdUI::SettingModelConfigChangePwdUI()
{
    // 初始化
    this->setResizeMode(QQuickWidget::SizeRootObjectToView);
    this->setFixedSize(440, 260);
    this->setWindowFlags(Qt::Window | Qt::WindowCloseButtonHint);
    this->setWindowTitle("修改密码");

    this->_rootContext = this->getContext();
    // 传入ModelConfigNewUI类
    this->rootContext()->setContextProperty("changePwd", this);
    // 资源加载
    this->setSource(QUrl("qrc:/SettingModelConfigChangePwd.qml"));
    this->_rootObj = this->getRootObject();
    if(_rootObj)
    {
        // 取消
        connect(_rootObj, SIGNAL(cancel()), this, SLOT(onCancel()));
    }
}

/**
 * @brief 析构函数
 */
SettingModelConfigChangePwdUI::~SettingModelConfigChangePwdUI() {}

/**
 * @brief getContext 获取qmlcontext
 * @return qmlContext
 */
QQmlContext* SettingModelConfigChangePwdUI::getContext() const
{
    return this->rootContext();
}

/**
 * @brief getRootObject 获取rootObject
 * @return rootObject
 */
QObject* SettingModelConfigChangePwdUI::getRootObject() const
{
    return (QObject*)this->rootObject();
}

/**
 * @brief 取消
 */
void SettingModelConfigChangePwdUI::onCancel()
{
    this->close();
}
